// import axios from './axios'

// export const getMenu = () => {
//   return axios.request({
//     url: 'menu',
//     method: 'get'
//   })
// }


export const getHome = () => {
    return axios.request({
        url: '/home/getData',
        method: 'get'
    })
}

export const getUser = (params) => {
    return axios.request({
        url: '/user/getUser',
        method: 'get',
        params
    })
}

export const getMenu = (params) => {
    return axios.request({
        url: '/permission/getMenu',
        method: 'post',
        data: params
    })
}

// 果蔬识别
export const distinguish = (params) => {
    return axios.request({
        url: "http://127.0.0.1:5000/apis/fruit/",
        method: 'POST',
        data: JSON.stringify({
            img: params
        }),
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}

// 用户登录
export const authLogin = (params) => {
    return axios.request({
        url: 'http://127.0.0.1:5000/apis/auth/',
        method: 'post',
        data: params,
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}

//使用次数
export const usages = () => {
    return axios.request({
        url: 'http://127.0.0.1:5000/apis/usages/',
        method: 'get',
    })
}

//新用户和活跃用户
export const new_and_active = () => {
    return axios.request({
        url: 'http://127.0.0.1:5000/apis/new_and_active/',
        method: 'get',
    })
}

//用户数量与使用次数
export const nusers_and_nusages = () => {
    return axios.request({
        url: 'http://127.0.0.1:5000/apis/nusers_and_nusages/',
        method: 'get',
    })
}